package com.ujiuye.web;

import com.ujiuye.entity.Student;
import com.ujiuye.service.StudentService;
import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import java.util.UUID;

@MultipartConfig
@WebServlet("/updateUIStu")
public class UpdateStuUIServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //解决中文乱码
//        req.setCharacterEncoding("utf-8");
//        resp.setContentType("text/html;charset=utf-8");
        PrintWriter pw = resp.getWriter();
        //获取页面发送的id参数
        String id = req.getParameter("sid");
        StudentService ss = new StudentService();
        //调用查询方法
        Student student = ss.queryStuById(id);
        //绑定数据-->转发对应页面
        req.setAttribute("s",student);
        req.getRequestDispatcher("updateStu.jsp").forward(req,resp);
    }
}
